package com.hqyj.mqservice;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @Description 消费扇形交换机发送的消息
 * @Autor 伍军
 * @Date 2022/10/18 13:57
 * @Version 1.0
 **/
@Component
public class MqFanoutServer {

    @RabbitListener(queues = "fountQueue01")
    public void add(Channel c, Message message, Map<String,Object> map){
        System.out.println("1111111111111111111111111111");
        System.out.println("消息编号:"+message.getMessageProperties().getDeliveryTag());
        System.out.println("用户名："+map.get("userName"));
        System.out.println("密码："+map.get("userPwd"));
    }
    @RabbitListener(queues = "fountQueue02")
    public void add01(Channel c, Message message, Map<String,Object> map){
        System.out.println("22222222222222222222222");
        System.out.println("消息编号:"+message.getMessageProperties().getDeliveryTag());
        System.out.println("用户名："+map.get("userName"));
        System.out.println("密码："+map.get("userPwd"));
    }
    @RabbitListener(queues = "fountQueue03")
    public void add02(Channel c, Message message, Map<String,Object> map){
        System.out.println("33333333333333333333");
        System.out.println("消息编号:"+message.getMessageProperties().getDeliveryTag());
        System.out.println("用户名："+map.get("userName"));
        System.out.println("密码："+map.get("userPwd"));
    }

}
